def insert(x:Int,xs:List[Int]):List[Int]= {
    if(xs.isEmpty) List(x)
    else if(x<=xs.head) {x::xs}
    else (xs.head::insert(x,xs.tail))
}

def isort(xs: List[Int]):List[Int]= {
    if(xs.isEmpty) Nil
    else insert(xs.head,isort(xs.tail))
}

val l=List(6,5,3,2,8)
println(l)
println(isort(l))
